//
//  UDAlertView.h
//  UDPhone
//
//  Created by 115 on 14-2-12.
//  Copyright (c) 2014年 YLMF Co.,Inc. All rights reserved.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

typedef void(^UDAlertClickedBlock)(NSInteger index);
typedef void(^UDAlertDidDisMissBlock)(NSInteger index);

@interface Alert : NSObject

@property (nonatomic, copy, nullable) UDAlertClickedBlock clickedBlock;
@property (nonatomic, copy, nullable) UDAlertDidDisMissBlock didMissBlock;
@property (readonly, nonatomic, weak, nullable) UIAlertController *alertController;

#pragma mark -- 弹窗

/**
 系统弹窗
 1.确定  取消  数组传 @[@"确定",@"取消"]
 2.若只要一个确定按钮  只传 @[@"确定"]
 3.若传3个, 则会在正中间弹窗 ActionSheet 类型
 
 */
+ (Alert *)showAlertViewWithTitle:(nullable NSString *)title message:(nullable NSString *)message dismissBlock:(nullable UDAlertDidDisMissBlock)didMissBlock cancelButtonIndex:(NSInteger)index titles:(nullable NSArray<NSString *> *)titles;


/**
 系统弹窗 ActionSheet类型
 若不要取消按钮 则cancelButtonIndex 不要传数组的下标 随便传
 若不要destructive按钮 则destructiveButtonIndex 不要传数组的下标 随便传
 
 */
+ (Alert *)showActionSheetWithTitle:(nullable NSString *)title message:(nullable NSString *)message dismissBlock:(nullable UDAlertDidDisMissBlock)didMissBlock cancelButtonIndex:(NSInteger)index destructiveButtonIndex:(NSInteger)destructiveIndex titles:(NSArray<NSString *> *)titles;

@end



@interface AlertManager : NSObject

@property (readonly, nonatomic, strong) NSArray<Alert *> *availableAlerts;

+ (AlertManager *)defaultManager;

- (void)addAlert:(Alert *)alert;
- (void)removeAlert:(Alert *)alert;
- (void)removeAllAlerts;
@end

NS_ASSUME_NONNULL_END
